package com.genius.auth.bo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;

@Data
@ApiModel(value = "注册用户BO", description = "从客户端，由用户传入的数据封装在此entity中")
public class RegisterBO {

    @NotBlank(message = "姓名不能为空")
    @Pattern(regexp = "^[\\u4e00-\\u9fa5]{2,10}$", message = "姓名不正确")
    @ApiModelProperty("姓名")
    private String name;

    @NotBlank(message = "邮箱不能为空")
    @Email(message = "邮箱不正确")
    @ApiModelProperty("邮箱")
    private String email;

    @NotBlank(message = "验证码不能为空")
    @Pattern(regexp = "^[a-zA-Z\\d]{6}$", message = "验证码格式不正确")
    @ApiModelProperty("验证码")
    private String checkCode;

    @NotBlank(message = "用户账号不能为空")
    @Pattern(regexp = "^[a-zA-Z\\d]{5,20}$", message = "用户账号不正确")
    @ApiModelProperty("用户账号")
    private String username;

    @NotBlank(message = "密码不能为空")
    @Pattern(regexp = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z\\W]{6,18}$", message = "密码必须包含字母和数字，且在6-18位之间")
    @ApiModelProperty("密码")
    private String password;
}